@import 'mixins_and_variables_and_functions';

$work-item-field-inset-shadow: inset 0 0 0 $gl-border-size-1 var(--gray-200, $gray-200) !important;
$work-item-overview-right-sidebar-width: 340px;
$work-item-sticky-header-height: 52px;

.gl-token-selector-token-container {
  display: flex;
  align-items: center;
}

.hide-unfocused-input-decoration:not(:focus, :hover),
.hide-unfocused-input-decoration:disabled {
  background-color: transparent;
  border-color: transparent;
  background-image: none;
  box-shadow: none;
}

.work-item-assignees {
  .assign-myself {
    display: none;
  }

  @include media-breakpoint-up(sm) {
    .assignees-selector:hover .assign-myself {
      display: block;
    }
  }
}

.work-item-due-date {
  .gl-datepicker-input.gl-form-input.form-control {
    width: 10rem;

    &:not(:focus, :hover) {
      box-shadow: none;

      ~ .gl-datepicker-actions {
        display: none;
      }
    }

    &[disabled] {
      background-color: var(--white, $white);
      box-shadow: none;

      ~ .gl-datepicker-actions {
        display: none;
      }
    }
  }

  .gl-datepicker-actions:focus,
  .gl-datepicker-actions:hover {
    display: flex !important;
  }
}

.work-item-labels {
  .gl-token {
    padding-left: $gl-spacing-scale-1;
  }

  .gl-token-close {
    display: none;
  }
}

.work-item-dropdown {
  // duplicate classname because we are fighting with gl-button styles
  .gl-dropdown-toggle.gl-dropdown-toggle {
    background: none;

    &:hover,
    &:focus {
      box-shadow: $work-item-field-inset-shadow;
      background-color: $input-bg;

      .gl-dark & {
        // $input-bg is overridden in dark mode but that does not
        // work in page bundles currently, manually override here
        background-color: var(--gray-50, $input-bg);
      }
    }

    &.is-not-focused:not(:hover, :focus) {
      box-shadow: none;

      .gl-button-icon {
        visibility: hidden;
      }
    }
  }

  > .col {
    min-width: 0;
  }
}

// sticky error placement for errors in modals , by default it is 83px for full view
#work-item-detail-modal {
  .flash-container.flash-container-page.sticky {
    top: -8px;
  }
}


.work-item-notifications-form {
  .gl-toggle {
    @include gl-ml-auto;
  }

  .gl-toggle-label {
    @include gl-font-weight-normal;
  }
}

.work-item-overview {
  @include media-breakpoint-up(md) {
    display: grid;
    grid-template-columns: 1fr $work-item-overview-right-sidebar-width;
    gap: 2rem;
  }
}

.work-item-overview-right-sidebar {
  @include media-breakpoint-up(md) {
    &.is-modal {
      .work-item-attributes-wrapper {
        top: 0;
      }
    }
  }
}

.work-item-attributes-wrapper {
  .work-item-overview & {
    @include media-breakpoint-up(md) {
      top: calc(#{$calc-application-header-height} + #{$work-item-sticky-header-height});
      height: calc(#{$calc-application-viewport-height} - #{$work-item-sticky-header-height});
      margin-bottom: calc(#{$content-wrapper-padding} * -1);
      position: sticky;
      overflow-y: auto;
      overflow-x: hidden;
    }
  }
}

.work-item-field-label {
  .work-item-overview & {
    max-width: 30%;
    flex: none;
  }
}

.work-item-field-value {
  .work-item-overview & {
    max-width: 65%;
  }

  &.gl-form-select {
    &:hover,
    &:focus {
      box-shadow: $work-item-field-inset-shadow;
    }
  }
}

.token-selector-menu-class {
  .work-item-overview & {
    width: 100%;
    min-width: 100%;
  }
}
